HAL CRC control functions migration

This section provides information about the HAL CRC control functions migration.

HAL CRC accumulate

In HAL1, the HAL_CRC_Accumulate() returns the result directly by value, while in HAL2, the result is stored in a pointer variable.

HAL1

HAL2

uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc,
                   uint32_t pBuffer[],
                   uint32_t BufferLength);
hal_status_t HAL_CRC_Accumulate(hal_crc_handle_t *hcrc,
                   const void *p_data,
                   uint32_t size_byte,
                   uint32_t *p_crc_result);

Related use case:: CRC accumulate


HAL CRC calculate

In HAL1, the HAL_CRC_Calculate() follows a return-by-value approach, whereas in HAL2, the result is stored in a pointer variable.

HAL1

HAL2

uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc,
                   uint32_t pBuffer[],
                   uint32_t BufferLength);
hal_status_t HAL_CRC_Calculate(hal_crc_handle_t *hcrc,
                   const void *p_data,
                   uint32_t size_byte,
                   uint32_t *p_crc_result);

Related use cases:


HAL CRC unitary configuration functions

This section provides information about the HAL CRC unitary configuration functions migration.

Configure CRC polynomial settings

In HAL2, the crc_init_value was added to the HAL_CRC_SetInputReverseMode() function.

HAL1

HAL2

HAL_CRCEx_Polynomial_Set(CRC_HandleTypeDef *hcrc,
                         uint32_t Pol,
                         uint32_t PolyLength)
HAL_CRC_SetConfigPolynomial(hal_crc_handle_t *hcrc,
                            uint32_t poly_coefficient,
                            hal_crc_polynomial_size_t poly_size,
                            uint32_t crc_init_value)

Set CRC input data

HAL1

HAL2

HAL_CRCEx_Input_Data_Reverse(CRC_HandleTypeDef *hcrc,
                             uint32_t InputReverseMode)
HAL_CRC_SetInputReverseMode(hal_crc_handle_t *hcrc,
                            hal_crc_input_data_reverse_mode_t input_reverse_mode)

Set CRC output data

HAL1

HAL2

HAL_CRCEx_Output_Data_Reverse(CRC_HandleTypeDef *hcrc,
                              uint32_t OutputReverseMode)
HAL_CRC_SetOutputReverseMode(hal_crc_handle_t *hcrc,
                             hal_crc_output_data_reverse_mode_t output_reverse_mode)